package ch7;

import java.util.Scanner;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CaculatorTest2 {
	// 引入slf4j
	public static final Logger Log = LoggerFactory.getLogger("ch7.CaculatorTest2");

	public static void main(String[] args) {
		if (Log.isDebugEnabled())// 允许
			Log.debug("开始测试计算器类了：");
		Scanner in = new Scanner(System.in);
		Caculator c = new Caculator();
		System.out.println("输入两个数：");
		try {
			int a = in.nextInt();
			int b = in.nextInt();
			Log.info("输入完成，分别是  " + a + "," + b);
			Log.info("准备计算他们的商：");

			int shang = c.divide(a, b);
			Log.info("结果是：" + shang);
		} catch (RuntimeException e) {

			// e.printStackTrace();
			Log.warn("除法错误");
			Log.error("除法出现错误", e);
		}
	}

}
